# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=swayrbar
pkgver=0.2.2
pkgrel=0
pkgdesc="A status command for Sway's swaybar"
url="https://sr.ht/~tsdh/swayr/"
arch="aarch64 armhf armv7 ppc64le x86 x86_64"  # limited by rust/cargo
license="GPL-3.0-or-later"
makedepends="cargo"
source="$pkgname-$pkgver.tar.gz::https://git.sr.ht/~tsdh/swayr/archive/swayrbar-$pkgver.tar.gz"
builddir="$srcdir/swayr-swayrbar-$pkgver"

export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1
export CARGO_PROFILE_RELEASE_LTO="true"
export CARGO_PROFILE_RELEASE_OPT_LEVEL="z"
export CARGO_PROFILE_RELEASE_PANIC="abort"

prepare() {
	default_prepare
	cargo fetch --locked
}

build() {
	cargo build -p swayrbar --release --frozen
}

check() {
	cargo test -p swayrbar --frozen
}

package() {
	install -D -m755 target/release/swayrbar -t "$pkgdir"/usr/bin/
}

sha512sums="
615fa34965a524089dedbbf123eb295f00c62c6d413875c8c66d113347f88afdf4a2f4e57ac5f6ca53d2658ea25ab5dc93e92969981fbe2fa38f519982b85db2  swayrbar-0.2.2.tar.gz
"
